Command Line Tool

There is a completely new command line tool which you can use to administer domains and accounts as well as all system variables. This tool is called tool.exe and you can find it directly in the <InstallDirectory> folder. For Linux, this is called tool.sh. It is easy to use and you only have to know the API constants. Complete list of API constants is in the APIconst.pas file in the <InstallDirectory>\API\Delphi\ folder.

Note: Using tool.exe for performing large operation can cause temporary service unavailability because the service needs to be restarted for some changes in configuration. For servers with many domains and many users with high load, restarting can take some time. Therefore, we recommend performing large batches of changes in low-load periods.

Note: Command line tool does not support multi-line - you can encounter this e.g. using the autoresponder variable.

Parameter

Description

ACCOUNT [variables]

Address any account on the server.

DOMAIN [variables]

Address any domain on the server.

SYSTEM [variables]

Address any system variable such as c_version, c_name, etc. List is also in APIConst.pas

BATCH batchfile

Allows you to run a batch file with a set of commands included. See examples below.

Batchfile is just a common text file with commands. Each on a separate line. These commands must not include "tool" at the beginning. Just the commands and parameters.

USERSTATISTICS fromdate todate filterstring outputfile

Saves user statistics between fromdate and todate to specified output file for all users that fulfill the condition of filterstring.

fromdate, todate have yyyy/mm/dd format

filterstring supports also asterisks and question marks to specify more accounts. If it does not contain @ symbol it is considered as domain name.

outputfile - if you do not specify absolute path, it will be saved to the <InstallDirectory> folder.

How to create other types of accounts

To do this, you have to use the u_type property. Its values are also written in the APIConst.pas file. For example mailing list has 1 as a value of this property. So if I want to create mailing list, I will have to use this:

tool create account mailing@icewarpdemo.com u_type 1 m_owneraddress "admin@icewarpdemo.com"

Usage

tool create account new@icewarpdemo.com u_name "New Account" u_password "pass" u_accounttype 2

  • It creates an account with New Account in Full Name field and pass as password.

tool display account new@icewarpdemo.com u_mailbox u_accounttype

  • It shows you values of both variables of u_mailbox and u_accounttype of the new@icewarpdemo.com account.

tool delete domain oldone.net

  • It deletes the oldone.net domain from your server.

tool modify account *@icewarpdemo.com u_accounttype 2

  • It changes all accounts in icewarpdemo.com to IMAP accounts.

tool file userstatistics 2004/12/25 2004/12/31 icewarpdemo.com statistics.txt

  • It saves user statistics between dates 2004/12/25 and 2004/12/31 for all accounts in icewarpdemo.com domain to the statistics.txt file. This file can be found in the <install_dir> folder.

tool export domain * d_description d_postmaster

  • It shows on the screen the d_description and d_postmaster variables for all domains in CSV format - each value is separated by comma.

tool export account *@* u_mailbox u_name u_password > accounts.txt

  • Besides exporting the three above fields, it also puts user's full email address into the first column.

tool import account contas.txt u_name u_password

  • Imports three fields from CSV.

    Note: The first field imported from this CSV file is an email address - it is imported automatically and is not to be written in the import command. It has to be specified in CSV in the first place.

tool display system c_config_services_pop3_port

  • It shows the system variable that contains a POP3 service port.

tool file batch create_mailing.txt

  • where create_mailing.txt looks like:

    create account mailing1@icewarpdemo.com u_type 1 m_owneraddress "admin@icewarpdemo.com"

    create account mailing2@icewarpdemo.com u_type 1 m_owneraddress "admin@icewarpdemo.com"

    create account mailing3@icewarpdemo.com u_type 1 m_owneraddress "admin@icewarpdemo.com"

  • It creates three mailing lists defined in the create_mailing.txt file.

tool check account *@* passpolicy

  • It verifies which accounts do not comply with the new password policy.

tool check account *@* passpolicy > <filename>

  • It redirects to a file.

    Example:

    tool check account *@* passpolicy>outofpolicy.txt

tool display account @*@ > accounts.txt

  • Gets a listing of accounts with double line feeds.

tool export account *@* > accounts.txt

  • listing with single line feeds.

    Note: Passwords can contain special chars. All quotes are prefixed with backslashes. If there is a comma in a password, this password is quoted.